<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    function Foo(text){
        this.text = text
    }


    function foo(){


        let test2 = new Foo('test1... ...')
        function  f(){

            if(test2){
                 console.log('test2... ...',test2)
            }
        }

        f()

    }

    foo()
</script>
</html>